package com.yy.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yy.entity.Order;
import com.yy.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService extends ServiceImpl<OrderMapper, Order> {
    OrderMapper mapper;
    @Autowired
    public OrderService(OrderMapper mapper) {
        this.mapper = mapper;
    }
    public List<Order> getAll(){
        List<Order> results=mapper.getAll();
        return results;
    }
    public Order getById(Long id) {
        Order entity=mapper.getById(id);
        return entity;
    }
    public Long insert(Order entity) {
        boolean result=mapper.insert(entity)>0?true:false;
        return Long.valueOf(mapper.insert(entity));
    }
    public boolean update(Order entity) {
        boolean result=mapper.update(entity)>0?true:false;
        return result;
    }
    public boolean delete(Order entity) {
        boolean result=mapper.deleteById(entity)>0?true:false;
        return result;
    }
}
